<%-- 
    Document   : edit
    Created on : 24.11.2012, 16:38:08
    Author     : mprokes
--%>

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>

<c:choose>
    <c:when test="${actionBean.team.id == null}">
        <c:set var="title_key" value="team.add.title" />
        <c:set var="form_action" value="add" />
    </c:when>
    <c:otherwise>
        <c:set var="title_key" value="team.edit.title" />
        <c:set var="form_action" value="save" />
    </c:otherwise>
</c:choose>

<f:message key="${title_key}" var="title" />

<s:layout-render name="/layout.jsp" title="${title}">
    <s:layout-component name="content">                             
        <h1><f:message key="${title_key}" /></h1>
        
        <s:form beanclass="cz.muni.fi.pa165.sportclubmanager.web.TeamsActionBean" class="form">
            <s:errors/>
            
            <s:hidden name="team.id"/>           

            <div class="form-field">
                <s:label for="a1" name="team.name"/> <s:text id="a1" name="team.name"/>
            </div>

            <div class="form-field">    
                <s:label for="a2" name="ageCategory"/> <s:select id="a2" name="team.ageCategory.id">
                    <s:options-collection collection="${actionBean.allAgeCategories}" label="name" value="id"/>
                </s:select>
            </div>

            <div class="form-field form-field-submit">
                <s:submit name="${form_action}" class="button" />
            </div>
        </s:form>
 
    </s:layout-component>
</s:layout-render>